Design a pda to accept L={0^n1^m0^m1^n|m,n>=1}?
Designing a PDA to accept L={0^n1^m0^m1^n|m,n>=1}
To design a PDA to accept the language L={0^n1^m0^m1^n|m,n>=1}, we need to follow a few steps:
1. Define the PDA's states:
The PDA will have four states:
a. q0: the initial state
b. q1: a state that pushes 0 onto the stack
c. q2: a state that pops 0 from the stack
d. q3: the final state
2. Define the PDA's input alphabet and stack alphabet:
The input alphabet consists of 0's and 1's, while the stack alphabet consists of 0's, 1's, and the stack symbol Z.
3. Define the PDA's transition function:
The transition function of the PDA can be defined as follows:
a. From state q0, if we read a 0, we push a 0 onto the stack and move to state q1.
b. From state q1, if we read a 0, we push a 0 onto the stack and remain in state q1.
c. From state q1, if we read a 1, we pop a 0 from the stack and move to state q2.
d. From state q2, if we read a 1, we pop a 0 from the stack and remain in state q2.
e. From state q2, if we read a 0, we move to state q3.
f. From state q3, if we read a 1, we move to state q3.
4. Define the PDA's acceptance criteria:
The PDA will accept the input string if it ends in state q3 and the stack is empty.
5. Draw the state diagram of the PDA:
The state diagram of the PDA can be drawn as follows:
q0 --0,Z/0Z--> q1
q1 --0,Z/0Z--> q1
q1 --1,0/ε--> q2
q2 --1,0/ε--> q2
q2 --0,Z/ε--> q3
q3 --1,Z/ε--> q3
In conclusion, by following the above steps, we can design a PDA that can accept the language L={0^n1^m0^m1^n|m,n>=1}.
Design a pda to accept L={0^n1^m0^m1^n|m,n>=1}?
- Step-1: On receiving 0 push it onto stack. On receiving 1, push it onto stack and goto next state
- Step-2: On receiving 1 push it onto stack. On receiving 0,pop 1 from stack and goto next state
- Step-3: On receiving 0 pop 1 from stack. If all the 1’s have been popped out of stack and now receive 1 then pop a 0 from stack and goto next state
- Step-4: On receiving 1 pop 0 from stack. If input is finished and stack is empty then goto last state and string is accepted
